0 CpxTRS
↳1 TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID), 0 ms)
↳2 CpxWeightedTrs
↳3 TypeInferenceProof (BOTH BOUNDS(ID, ID), 1 ms)
↳4 CpxTypedWeightedTrs
↳5 CompletionProof (UPPER BOUND(ID), 0 ms)
↳6 CpxTypedWeightedCompleteTrs
↳7 CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID), 0 ms)
↳8 CpxRNTS
↳9 CompleteCoflocoProof (⇔, 158 ms)
↳10 BOUNDS(1, n^1)
a__f(X, X) → a__f(a, b)
a__b → a
mark(f(X1, X2)) → a__f(mark(X1), X2)
mark(b) → a__b
mark(a) → a
a__f(X1, X2) → f(X1, X2)
a__b → b
a__f(X, X) → a__f(a, b) [1]
a__b → a [1]
mark(f(X1, X2)) → a__f(mark(X1), X2) [1]
mark(b) → a__b [1]
mark(a) → a [1]
a__f(X1, X2) → f(X1, X2) [1]
a__b → b [1]
a__f(X, X) → a__f(a, b) [1]
a__b → a [1]
mark(f(X1, X2)) → a__f(mark(X1), X2) [1]
mark(b) → a__b [1]
mark(a) → a [1]
a__f(X1, X2) → f(X1, X2) [1]
a__b → b [1]
a__f :: a:b:f → a:b:f → a:b:f a :: a:b:f b :: a:b:f a__b :: a:b:f mark :: a:b:f → a:b:f f :: a:b:f → a:b:f → a:b:f |
Runtime Complexity Weighted TRS with Types. The TRS R consists of the following rules:
The TRS has the following type information:
Rewrite Strategy: INNERMOST |
a => 0
b => 1
a__b -{ 1 }→ 1 :|:
a__b -{ 1 }→ 0 :|:
a__f(z, z') -{ 1 }→ a__f(0, 1) :|: z' = X, X >= 0, z = X
a__f(z, z') -{ 1 }→ 1 + X1 + X2 :|: X1 >= 0, X2 >= 0, z = X1, z' = X2
mark(z) -{ 1 }→ a__f(mark(X1), X2) :|: X1 >= 0, X2 >= 0, z = 1 + X1 + X2
mark(z) -{ 1 }→ a__b :|: z = 1
mark(z) -{ 1 }→ 0 :|: z = 0
eq(start(V, V1),0,[fun(V, V1, Out)],[V >= 0,V1 >= 0]). eq(start(V, V1),0,[fun1(Out)],[]). eq(start(V, V1),0,[mark(V, Out)],[V >= 0]). eq(fun(V, V1, Out),1,[fun(0, 1, Ret)],[Out = Ret,V1 = X3,X3 >= 0,V = X3]). eq(fun1(Out),1,[],[Out = 0]). eq(mark(V, Out),1,[mark(X11, Ret0),fun(Ret0, X21, Ret1)],[Out = Ret1,X11 >= 0,X21 >= 0,V = 1 + X11 + X21]). eq(mark(V, Out),1,[fun1(Ret2)],[Out = Ret2,V = 1]). eq(mark(V, Out),1,[],[Out = 0,V = 0]). eq(fun(V, V1, Out),1,[],[Out = 1 + X12 + X22,X12 >= 0,X22 >= 0,V = X12,V1 = X22]). eq(fun1(Out),1,[],[Out = 1]). input_output_vars(fun(V,V1,Out),[V,V1],[Out]). input_output_vars(fun1(Out),[],[Out]). input_output_vars(mark(V,Out),[V],[Out]). |
CoFloCo proof output:
Preprocessing Cost Relations
=====================================
#### Computed strongly connected components
0. recursive : [fun/3]
1. non_recursive : [fun1/1]
2. recursive [non_tail] : [mark/2]
3. non_recursive : [start/2]
#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into fun/3
1. SCC is partially evaluated into fun1/1
2. SCC is partially evaluated into mark/2
3. SCC is partially evaluated into start/2
Control-Flow Refinement of Cost Relations
=====================================
### Specialization of cost equations fun/3
* CE 6 is refined into CE [12]
* CE 5 is refined into CE [13]
### Cost equations --> "Loop" of fun/3
* CEs [13] --> Loop 9
* CEs [12] --> Loop 10
### Ranking functions of CR fun(V,V1,Out)
#### Partial ranking functions of CR fun(V,V1,Out)
### Specialization of cost equations fun1/1
* CE 8 is refined into CE [14]
* CE 7 is refined into CE [15]
### Cost equations --> "Loop" of fun1/1
* CEs [14] --> Loop 11
* CEs [15] --> Loop 12
### Ranking functions of CR fun1(Out)
#### Partial ranking functions of CR fun1(Out)
### Specialization of cost equations mark/2
* CE 10 is refined into CE [16,17]
* CE 11 is refined into CE [18]
* CE 9 is refined into CE [19,20]
### Cost equations --> "Loop" of mark/2
* CEs [20] --> Loop 13
* CEs [19] --> Loop 14
* CEs [17] --> Loop 15
* CEs [16] --> Loop 16
* CEs [18] --> Loop 17
### Ranking functions of CR mark(V,Out)
* RF of phase [13,14]: [V]
#### Partial ranking functions of CR mark(V,Out)
* Partial RF of phase [13,14]:
- RF of loop [13:1,14:1]:
V
### Specialization of cost equations start/2
* CE 2 is refined into CE [21,22]
* CE 3 is refined into CE [23,24]
* CE 4 is refined into CE [25,26,27]
### Cost equations --> "Loop" of start/2
* CEs [21,22,23,24,25,26,27] --> Loop 18
### Ranking functions of CR start(V,V1)
#### Partial ranking functions of CR start(V,V1)
Computing Bounds
=====================================
#### Cost of chains of fun(V,V1,Out):
* Chain [10]: 1
with precondition: [V+V1+1=Out,V>=0,V1>=0]
* Chain [9,10]: 2
with precondition: [Out=2,V=V1,V>=0]
#### Cost of chains of fun1(Out):
* Chain [12]: 1
with precondition: [Out=0]
* Chain [11]: 1
with precondition: [Out=1]
#### Cost of chains of mark(V,Out):
* Chain [[13,14],17]: 5*it(13)+1
Such that:aux(3) =< V
it(13) =< aux(3)
with precondition: [V>=1,Out>=1,V+1>=Out]
* Chain [[13,14],16]: 5*it(13)+2
Such that:aux(4) =< V
it(13) =< aux(4)
with precondition: [V>=2,Out>=1,V>=Out]
* Chain [[13,14],15]: 5*it(13)+2
Such that:aux(5) =< V
it(13) =< aux(5)
with precondition: [Out>=2,V>=Out]
* Chain [17]: 1
with precondition: [V=0,Out=0]
* Chain [16]: 2
with precondition: [V=1,Out=0]
* Chain [15]: 2
with precondition: [V=1,Out=1]
#### Cost of chains of start(V,V1):
* Chain [18]: 15*s(8)+2
Such that:s(7) =< V
s(8) =< s(7)
with precondition: []
Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [18] with precondition: []
- Upper bound: nat(V)*15+2
- Complexity: n
### Maximum cost of start(V,V1): nat(V)*15+2
Asymptotic class: n
* Total analysis performed in 105 ms.